<?php
namespace app\common\model;

use think\Model;

/**   YSF
 *    用户账单记录 模型
 *    Date: 2018/9/21
 * Class CustomerBillModel
 * @package app\common\model
 */
class CustomerBillModel extends Model
{
    // 表名
    protected $name = 'customer_bill';

    // 列表查询
    public function getAll($where, $page, $pageSize, $field, $order)
    {
        $result = $this->where($where)
                    ->field($field)
                    ->page($page, $pageSize)
                    ->order($order)
                    ->select();
        return $result;
    }

    // 连表列表查询
    public function getJoinAll($where, $page, $pageSize, $join, $field, $order)
    {
        $result = $this->alias('a')
                    ->where($where)
                    ->field($field)
                    ->join($join)
                    ->page($page, $pageSize)
                    ->order($order)
                    ->select();
        return $result;
    }

    // 连表数量查询
    public function getJoinCount($where, $join)
    {
        $result = $this->alias('a')
                    ->where($where)
                    ->join($join)
                    ->count();
        return $result;
    }

}